<div class="form_item_block">
    <% tasks = scope[:job].getTasks()%>
    
    <%= scope[:job_form].fields_for com.thoughtworks.go.config.JobConfig::TASKS, tasks do |tasks_form| %>
        <div class="fieldset">
            <div class="form_item required">
                <%= label_tag random_dom_id('task_type_'), required_label_text('Task Type') %>
                <%= tasks_form.select(com.thoughtworks.go.config.Tasks::TASK_OPTIONS, task_options, {:selected => tasks.getTaskOptions()}, {:class => "task_type", :id => "job_task_options"}) %>
            </div>
            <div id="job_tasks">
                <% @task_view_models.select {|tvm| not is_fetch_task?(tvm.getTaskType())}.each do |tvm|
                   task = tvm.getModel()
                   task_class_name = task.getTaskType()
                %>
                    <div class="hidden task_entry <%= task_class_name -%>">
                        <%= tasks_form.fields_for task_class_name, task do |task_form| %>
                            <%== render_pluggable_form_template(tvm, form_name_provider(task_form), { :scope => {:task => task, :form => task_form, :hide_runif => scope[:hide_runif]}}) -%>
                        <% end %>
                    </div>
                <% end %>
            </div>
        </div>

    <% end %>
    <script type="text/javascript">
        Util.on_load(function() {
            new TaskEditor.TypeEditor({container: jQuery('#job_tasks'), switch_control: jQuery('#job_task_options'), entry_to_be_hidden: '.task_entry'});
            new TaskPluginView().bootstrapAngular();
        });
    </script>
</div>
